<template>
	<view>
		<view style="background-color: #2DBB55;" :style="{height:bgHeight}">
			<view
				style="display: flex;flex-direction: row;justify-content: space-between;margin-left: 20rpx;margin-right: 20rpx;"
				:style="{paddingTop:topHeigh}">
				<u-icon name="arrow-left" size="28" color="#ffffff" @click="finish"></u-icon>
				<text style="color: #ffffff;font-size: 36rpx;">账号绑定</text>
				<text style="height: 28rpx;width: 28rpx;"></text>
			</view>
			<u-cell custom-style="margin-top: 20rpx;" title="微信" label="已绑定">
				<u-icon slot="icon" size="32" name="/static/image_wechat.png"></u-icon>
				<u-tag slot="right-icon" text="解绑" type="success" plain @click="logoutShow=true"></u-tag>
			</u-cell>
			<u-modal :show="logoutShow" title="解除绑定" content="解除绑定后将不能使用微信一键登录" showCancelButton @confirm="unBingding"
				@cancel="logoutShow=false"></u-modal>
		</view>
	</view>
</template>

<script>
	import {
		ownUnbind
	} from '@/api/my.js';
	export default {
		data() {
			return {
				// 获取整个导航栏高度
				bgHeight: this.ToolClass.getNavtionBarAllHeight(),
				// 获取微信胶囊高度
				topHeigh: this.ToolClass.getWXJNHeight(),
				logoutShow: false
			}
		},
		onLoad() {

		},
		methods: {
			finish() {
				uni.navigateBack()
			},
			unBingding() {
				ownUnbind({
					token: uni.getStorageSync("token")
				}).then(res => {
					uni.setStorageSync('token', "")
					uni.setStorageSync('phone', "")
					uni.setStorageSync('id', "")
					uni.setStorageSync('name', "")
					uni.setStorageSync('isLogin', false)
					this.logoutShow = false
					this.finish()
				})
			}
		}
	}
</script>

<style>
</style>